package com.woniuxy.filter;

//@Component
//public class MyGlobalFilter implements GlobalFilter {
//    @Override
//    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//        //获得请求链接
//        String url = exchange.getRequest().getPath().toString();
//        //包含登陆和注册请求放行
//        if(url.endsWith("/user/login")||url.endsWith("/user/register")||url.endsWith("/user/getRegisterCode")){
//            return chain.filter(exchange);
//        }
//        List<String> token = exchange.getRequest().getHeaders().get("token");
//        //含有token且合法放行
//        if(null!=token&&null!=token.get(0))
//            return chain.filter(exchange);
//
//        throw new RuntimeException("没有token");
//    }
//
//
//
//
//}
